package com.jzo2o.market.controller.consumer;

import com.jzo2o.market.model.domain.Coupon;
import com.jzo2o.market.model.dto.request.SeizeCouponReqDTO;
import com.jzo2o.market.service.ICouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/*
 *   Description ConsumerCouponcontroller
 *   @author zhangyan
 *   @time   2024/12/15
 */
@RestController("consumercouponController")
@Slf4j
@Api(tags = "客户端优惠卷服务")
@RequestMapping("/consumer/coupon")
public class ConsumerCouponcontroller {
    @Autowired
    private ICouponService couponService;

    @GetMapping("/my")
    @ApiOperation("查询我的优惠卷")
    public List<Coupon> queryCouponList(@RequestParam("status") Integer status,@RequestParam("lastId") Long lastId) {
        return couponService.queryCouponList(status,lastId);
    }

    @PostMapping("/seize")
    public void seizeCoupon(@RequestBody SeizeCouponReqDTO seizeCouponReqDTO) {
        couponService.seizeCoupon(seizeCouponReqDTO.getId());
    }
}
